//
//  AppDelegate.m
//  Total
//
//  Created by xin on 2017/6/27.
//  Copyright © 2017年 elephants. All rights reserved.
//

#import "AppDelegate.h"
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    NSString * info = @"HQALAAFRAACUuwYAueMIAFALAACRuFoURJDNKP9T9SjitjRPfNgYw/5wJlNhq8gP1xu2fYd8fyEn4YGcc9i3vbqU+eWCn99HNL2L2Qkw+A+Qh9S2JAxDLnq0xu4kVrk7EaXoMbwR6TtOTmZvl1+t6ipXkTQ3SJX0mpc/nC4Z710AC6/4gy5T+8V2HjvQLS/PkomjujQ44Q3BDN6uU6l6XU3XFdNAdpLcMXYVen0G/iEs+B7L911aii04+SnpCpazU2OziOxMcQlVdJgg60Yrbl/TCCSW/D1o608S+dIOSgExz1iGXLpWdNrmkJejxpn0JU9H814J9mj4MGG2VcUuVvZZqV0EmS3lqnTEUIsiyRRoeu9AKr5JIkLba0ivgfmhqbw2PgKhMmX7mSKsg8y60Ihwv064M1tpEAFdq798RS1M1+IjdfS2fZnumVXpuOPjvPjdDp+pPYR5TcZS7C/yiFjUH54F+HwJIFKCIWJU/TWT2uzSdThjye+u3jbbZuh8LWkz4rGowF5wTUEj/MIphZS8hVASAC2koPubpSjmCBURGLhnyjsGc3TOA82Z47I7U8us5JNcjKRBTlYU0/uYppi4ftwLBF1aR3SM+MxyBVac3Jp8omkFLn6SOa1VRaLNUzgazNKtAvZjsuGviYcrACJ46EPJwoL7mfW8nHhmp9aSWJ7Y7uwID1fcLavvO+k62brhWb+ebHKdUeDXqSQdAFFuo2PyNpEj9vCy9Wib1dfGGVSaaM9aUXPxLsxfUPOV7+cD/tuUgaA2r7C++ZsjJGefqVizPdzfTVPNaXrCXIuzRrBJIZsN0Zb5qyUJFAzQemCnZFiXZyOEtFvFOW/OkQXjpVAyV0uRIc/9wNVCewMcCsBZS5S1wV5hzmi0Msv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nzXOHIly0jz0USQ1HNfiAznji0MrofcmNg14gtGAzPjtdZ8NifGyI5qGJN5ZPvtS6a2Z7CwDYGHqYg+lcAcr8iWeTI+7NtZ2ExAVBJNODuzUsHP5T8gsjCmIuqk6X1MjjSVHqIJ5PMNp2OOkS5xTIq22yWRAgYIxdpqCNPLabrQHO8rnUD7iTcy53O4Zi/0A7Qzs6ZwD5R+ulQPDID8Han7GCOZ5T/BjCpdaeks5hlj8oLk47x1ZmLeI3Uo3tQVr1SBvO5QiYdgGRTO+FZj3d+CXwJaV6uAHp53Gym6lWsl06SFSofcrYLX2dASSJatJGpQ9AvwX36NhVjzkOctb4MKlvAWl86+t2mecNOr295h/Fq5T/OMppbljGLaG7uWk4e7DF494PSlZEFf2N1c9usJ2ppuQnWvuucXj/ucPnBCpKm4wFEzRZsWMMGLMJi6dmaZSSnGv3m0yftXlmZ7Bd148YfEDO8h31xbiKabFbmsnD5a/T/nPaPlF0m/3de8+gUnFzhSXwjNEimT0nRicK2r4NUQczjxtdH6bbjVay8uwB9ZRnGF6NBwcUaN6QQ8fmCXqtpFpjYL60Y/Ng+apmmthVOtDj4lMAF1zkQAgX6u3vElKpBhVGEpWMo35FdDUu/BWKOqXNgfDPYRpAxYI+tYLn9rLEEhBhTXUrZwwzNRiXLgYJSXF4BDqzwa+3i6yv+0SfUYXAhua24G1/L9R1nRd4SZapYdTyfzexwBGahf/zNZ3RKRpsktaMXI0gq7rTMYQQemMy0Pxr8qM5M9GG1deAApix0S2p8r0vjJYDODkCNwdoenEFFx6iv";
    
    
    NSURL * url = [NSURL URLWithString:@"https://codeload.github.com/mrdoob/three.js/zip/dev"];
    NSArray * fileArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *fileName = [[fileArray firstObject] stringByAppendingPathComponent:url.path];
    NSLog(@"fileName=%@",fileName);
    NSLog(@"url pathComponents=%@",[url path]);
    NSLog(@"url pathExtension=%@",[url pathExtension]);
    NSLog(@"url lastPathComponent=%@",[url lastPathComponent]);
    NSLog(@"url lastPathComponent pathExtension=%@",[[url lastPathComponent] pathExtension]);
    
    NSString * systemVersion = [UIDevice currentDevice].systemVersion;
    
    if (systemVersion.doubleValue >= 9.0) {
        //针对 9.0 以上的iOS系统进行处理
    }
    else{
        //针对 9.0 以下的iOS系统进行处理
    }
    
    if(NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_9_0) {
        //针对 9.0 以上的iOS系统进行处理
    }
    else{
        //针对 9.0 以下的iOS系统进行处理
    }
    
    if (NSClassFromString(@"UNNotification")) {
        // 存在这个类 iOS 10.0 以上系统的处理
    } else {
        // iOS 10.0 以下系统的处理
    }
    
    if ([UIFont respondsToSelector:@selector(preferredFontForTextStyle:compatibleWithTraitCollection:)]) {
        // 存在这个方法 iOS 10.0 以上系统的处理
    } else {
        // iOS 10.0 以下系统的处理
    }
    
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(nonnull NSString *)identifier completionHandler:(nonnull void (^)())completionHandler
{
//    应用程序使用一个NSURLSession背景配置可能会在后台启动或恢复处理完成任务的会话,或者处理身份验证。调用这个方法将使用会话需要的标识符的关注。一次会话创建从一个配置对象的标识符,会话的委托将开始接收回调。如果这样的会话已经创建(如果应用程序正在恢复,例如),然后委托将开始接收由应用程序回调没有任何行动。你应该叫completionHandler一旦你完成处理回调。
    
    //进入后台任务后，在这里处理下载完成的操作，记得需要调用completionHandler方法，才能让session的代理方法执行并带参数
    
    self.backgroundSessionCompletionHandler = completionHandler;
}

@end
